package org.belkodevelop.geocoding.dao;

import org.belkodevelop.geocoding.domen.GeoCache;
import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

@Repository
public class GeoCacheDAOImpl implements GeoCacheDAO {
    
    @Autowired
    private SessionFactory sessionFactory;
    
    @Override
    public GeoCache getCache(String request) {
        return (GeoCache) sessionFactory.getCurrentSession().get(GeoCache.class, request);
    }

    @Override
    public void addCache(GeoCache geoCache) {
        sessionFactory.getCurrentSession().save(geoCache);
    }
    
}
